<?php
namespace Common\Model;

use Think\Model;

class ConfigModel extends Model
{
    /**
     * 获取Config模型配置项
     *
     * @return array
     */
    public function get_config()
    {
        $config = M('Config')->field('name,value')->select();

        $new_arr = array();
        foreach ($config as $key => $v) {
            $new_arr[$v['name']] = $v['value'];
        }

        // 上传文件驱动配置
        $new_arr['FILE_UPLOAD_TYPE'] = $new_arr['FILE_UPLOAD_TYPE'] ? 'Qiniu' : 'Local';
        $new_arr['UPLOAD_TYPE_CONFIG'] = unserialize($new_arr['UPLOAD_TYPE_CONFIG']);

        return $new_arr;
    }

}